package com.st.dao.impl;

import java.util.List;

import com.st.dao.IDeptDao;
import com.st.entity.Dept;
import com.st.util.DBUtil;

public class DeptDaoImpl implements IDeptDao{
	
	private DBUtil dbUtil = new DBUtil();
	
	@Override
	public List<Dept> selectAll() {
		String sql = "select * from dept";
		return dbUtil.query(sql, null, Dept.class);
	}

	@Override
	public List selectByKey(String key) {
		String sql = "select * from dept where dname like ? or droom like ? or dphone like ?";
		Object[] params = {"%"+key+"%", "%"+key+"%", "%"+key+"%"};
		return dbUtil.query(sql, params, Dept.class);
	}
}
